package com.example.boot05.mapper;

import com.example.boot05.entity.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProductMapper {
    @Insert("insert into product values (null , #{title} , #{price} , #{num})")
    void insert(Product product);

    // 查询全部数据不建议使用 select *这种写法;
    @Select("select id,title,price,num from product")
    List<Product> select();

    @Delete("delete from product where id=#{id}")
    void deleteByid(int id);

    @Update("update product set title=#{title},price=#{price},num=#{num} where id =#{id}")
    void update(Product product);
}